/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>
#include <queue>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 1e5 + 2;

int a[maxn], ans[maxn];

struct Node {
  int delta, id;
  bool operator<(const Node &rhs) const { return delta < rhs.delta; }
};

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    std::priority_queue<Node> pq;

    for (int i = 1; i <= n; ++i) {
      cin >> a[i];
    }
    for (int i = 2; i <= n; ++i) {
      if (a[i - 1] - a[i] > 0) pq.push(Node{a[i - 1] - a[i], i});
    }
    int cnt = n;
    while (!pq.empty()) {
      Node tmp = pq.top();
      pq.pop();
      ans[cnt--] = tmp.id;
    }
    for (int i = 1; i <= cnt; ++i) {
      cout << 1 << ' ';
    }
    for (int i = cnt + 1; i <= n; ++i) {
      cout << ans[i] << ' ';
    }
    cout << '\n';
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("C. Permutation Operations.in", "r", stdin);
  freopen("C. Permutation Operations.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
